package com.beaut.project.control;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.beaut.project.service.GDService;
import com.beaut.project.service.SMSService;

/**
 * SMS模块管理
 * @author ljs
 *
 */
@Controller
@RequestMapping("/sms")
public class SMSController  extends BaseControl{
	@Autowired 
	SMSService smsService;
	
  
    @RequestMapping(value = "/listPageSMS", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listPageSMS(HttpServletRequest request) {
    	Map<String, Object> map = getPagerMap(request);
    	map.putAll(requestParameterToMap(request));
    	map.put("recieve_user_id", this.getSessionUserId(request));
    	return smsService.listPageSMS(map);
    }
    @RequestMapping(value = "/listPageSMSNoSend", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listPageSMSNoSend(HttpServletRequest request) {
    	Map<String, Object> map = getPagerMap(request);
    	map.putAll(requestParameterToMap(request));
    	map.put("recieve_user_id", this.getSessionUserId(request));
    	return smsService.listPageSMSNoSend(map);
    }
    @RequestMapping(value = "/hasNoReadSMS", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String hasNoReadSMS(HttpServletRequest request) {
    	Map<String,Object> map = new HashMap<String,Object>();
    	map.put("recieve_user_id", this.getSessionUserId(request));
    	return smsService.hasNoReadSMS(map);
    }
    @RequestMapping(value = "/getSMS", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    public @ResponseBody String getSMS(HttpServletRequest request) {
    	Map<String, Object> map = requestParameterToMap(request);
    	return smsService.getSMS(map);
    }
    @RequestMapping(value = "/getSMSModule", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String getSMSModule(HttpServletRequest request) {
    	return smsService.getSMSModule();
    }
	@RequestMapping(value = "/updateSMSSend", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String updateSMSSend(HttpServletRequest request) {
		return smsService.updateSMSSend(requestParameterToMap(request));
	}
	@RequestMapping(value = "/updateSMSRead", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String updateSMSRead(HttpServletRequest request) {
		return smsService.updateSMSRead(requestParameterToMap(request));
	}
	@RequestMapping(value = "/deleteSMS", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String deleteSMS(HttpServletRequest request) {
		return smsService.deleteSMS(requestParameterToMap(request));
	}
}
